import java.util.ArrayList;

import com.epam.kozich.model.Book;
import com.epam.kozich.model.Order;
import com.epam.kozich.model.Person;

public class OrderManager {
	private Order order;
	private ArrayList<Order> listOrders = new ArrayList<Order>();

	public void zakaz(Person person, Book book) {
		order = new Order();
		order.setPerson(person);
		order.setBook(book);
		if (person.isInBlackList() && book.isNalichie()) {
			getListOrders().add(order);
			book.setNalichie(false);
		} else
			System.out.println("Error.Person in blacklist or book not found");
	}

	public ArrayList<Order> getListOrders() {
		return listOrders;
	}

	public void addOrderInList(Order order) {
		this.listOrders.add(order);
	}

}
